package com.hjs.blog.controller.admin;

import com.hjs.blog.entity.User;
import com.hjs.blog.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@Controller
public class UserController {

    @Autowired
    UserService userService;

    @RequestMapping(method = RequestMethod.POST,value = "/login")
     public String login(String username,String password) {

        User user = userService.getUserByNameOrEmail(username);
        if(user == null) {
            return "该用户不存在";
        } else {
            if(user.getUserPass() == password) {
                return  "登录成功";
            } else {
                return  "密码错误";
            }
        }
    }

}
